package com.by.service.impl;

import com.by.bean.Message;
import com.by.common.bean.PageBean;
import com.by.common.crud.BaseServiceImpl;
import com.by.mapper.MessageMapper;
import com.by.querypage.MessageQuery;
import com.by.service.MessageService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class MessageServiceImpl extends BaseServiceImpl<Message, MessageMapper> implements MessageService {
    @Override
    public PageBean query(MessageQuery query) {
        PageHelper.startPage(query.getPage(),query.getPageSize());
        List list = baseMapper.query(query);
        PageInfo info = new PageInfo(list);
        return new PageBean<>(query.getPage(),query.getPageSize(),info.getTotal(),list);
    }
}
